<template>
	<view class="fxhw-detail">
		<view :class="showhidden?'fxhw-main-hidden':'fxhw-main-show'">
			<view v-html="article"></view>
		</view>
		
		<view class="fxhw-more" v-if="showhidden" @click="showhiddenclick()">
			<view>查看详情</view>
		</view>
		
		
		<view class="fxhw-goods-lists">
			<goodsList :dataList="dataList" :index="current"></goodsList>
		</view>
	</view>
</template>

<script>
	import apiindex from '../../common/api/index';
	import goodsList from '../../components/goods/goods-list'
	export default {
		data() {
			return {
				gl_params:{
					id:0
				},
				current:1,
				showhidden:true,
				article:'',
				dataList:[],
			}
		},
		onLoad(option) {
			uni.showNavigationBarLoading()
			uni.setNavigationBarTitle({
			　　title:option.name
			})
			this.gl_params.id=option.id
			this.talentArticle()
		},
		components:{
			apiindex,
			goodsList
		},
		
		methods: {
			talentArticle(){
				apiindex.talentArticle(this.gl_params).then(res =>{
					if(res.code == 1){
						this.article=res.data.article
						let regex = new RegExp('<img', 'gi');
						this.article= this.article.replace(regex, `<img style="max-width: 100%;"`);
						this.dataList=res.data.items
						uni.hideNavigationBarLoading()
					}
				}).catch(cateres =>{
					
				});
			},
			showhiddenclick(){
				this.showhidden=this.showhidden?false:true
			}
		}
	}
</script>

<style scoped>
	page{
		width:100%;
	}
	.fxhw-detail{
		width:100%;
		background-color:#F5F5F5;
	}
	.fxhw-main-hidden{
		width:96%;
		padding:2% 2%;
		background-color:#FFFFFF;
		height:200upx;
		overflow:hidden;
	}
	.fxhw-main-show{
		width:96%;
		padding:2% 2%;
		background-color:#FFFFFF;
	}
	.fxhw-more{
		width:100%;
	}
	.fxhw-more>view{
		height:80upx;
		line-height:80upx;
		text-align: center;
		font-weight: bold;
	}
	.fxhw-goods-lists{
		background-color:#FFFFFF;
	}
</style>
